﻿#region Usings
using System;
using BK.BL;
using BK.Entities;
using BK.WebSite.AppCode;
using Lib.Data.CriteriaRoutine;
#endregion

namespace BK.WebSite.Controls
{
    public partial class CurrencyEdit : BkDataEditControl<CurrencyEntity, Currencies>
    {
        #region Instance Methods
        protected override void DoGetObjectFromEditor(CurrencyEntity entity)
        {
            entity.Name = tbxName.Text;
            entity.ShortName = tbxShortName.Text;
            entity.Description = tbxDescription.Text;
            entity.UserId.Value =
                BlContext.Instance.Users.LoadSingle(new Criteria("Login", Clause.Eq, Page.User.Identity.Name)).Id.Value;
        }

        protected override void DoPutObjectToEditor(CurrencyEntity entity)
        {
            tbxName.Text = entity.Name;
            tbxShortName.Text = entity.ShortName;
            tbxDescription.Text = entity.Description;
        }

        protected override void PrepareEditor()
        {
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }
        #endregion
    }
}